import requests

from api.get_header import get_header
from common.db_tools import DBTools


class ModifyEmpApi(object):
    def modify_emp(self, req_header, req_body, emp_id):
        resp = requests.put(url="http://ihrm2-test.itheima.net/api/sys/user/" + emp_id,
                            headers=req_header,
                            json=req_body)
        return resp


if __name__ == '__main__':
    emp = ModifyEmpApi()
    req_header = get_header()
    DBTools.db_iud("insert into bs_user(id,mobile,username) values('5559527','15766726763','嗯嗯嗯嗯额';")
    req_body = {"username": "吴柳子"}
    emp_id = "5559527"
    resp = emp.modify_emp(req_header, req_body, emp_id)
    print(resp.json())
